﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace NJL.Web.Controls
{
    public partial class WUCHeader : BaseUserControl
    {
        protected string FROM_URL = "";
        public string companyId;
        protected IList<Model.NJL_CS_AREA> listArea;
        NJL.BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        NJL.Model.NJL_COMPANY modelCompany;

        private readonly BLL.NJL_SYS_ANNOUNCEMENT bllNJL_SYS_ANNOUNCEMENT = new BLL.NJL_SYS_ANNOUNCEMENT();
        protected void Page_Load(object sender, EventArgs e)
        {
      
            listArea = new BLL.NJL_CS_AREA().GetModelList(" AREA_CODE like '" + WEBSITE_CODE.Substring(0, 2) + "%' and deep=2 ");
            if (UserId != "")
            {
                modelCompany = bllCompany.GetCompanyByUserIDModel(UserId);
                if (modelCompany != null)
                {
                    companyId = modelCompany.ID;
                }
            }
            if (!IsPostBack)
            {
                DataSet ds = bllNJL_SYS_ANNOUNCEMENT.GetList(3, "NJL_SYS_BASE_ID='" + WEBSITE_CODE + "'", "SORT desc,CREATE_DATE_TIME desc");
                rptNotice.DataSource = ds;
                rptNotice.DataBind();
            }
         
            if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
            {
                FROM_URL = Server.UrlEncode(Server.UrlDecode(Request.QueryString["url"]));
            }
            else
            {
                FROM_URL = Server.UrlEncode(Request.RawUrl);
            }
        }
    }
}